var express = require("express");
const app = require("../app");
var router = express.Router();
 
router.get('/',function(req,res){
    res.render('login',{title:'user'});
});
let user;
router.post('/',(req,res)=>{
    user = req.session.user;
    try{
        if (req.body.username == req.session.user.username&&req.body.password==req.session.user.pass){
            res.send("Sucess");
            
        }else{
            res.send("<p style =\" color : red ;\">用户名或密码错误</p>");
            }
        
    }catch(e){
        console.log(e);
        res.send("<p style =\" color : red ;\">用户名或密码错误</p>");
    }
    }
    )
module.exports = router;
